Codechef Long Challenge | Slow Solution | C++ Solution